package com.skyline.imagine.utils;

import java.util.HashMap;
import java.util.Map;

public class MimeTypes {
	private static final Map<String, String> mimeTypes = new HashMap<String, String>();
	private static final String OCTET_MIME_TYPE = "application/octet-stream";

	static {
		// Microsoft Windows bitmap image
		mimeTypes.put("bmp", "image/bmp");

		// CompuServe graphics interchange format
		mimeTypes.put("gif", "image/gif");

		// Microsoft icon
		mimeTypes.put("ico", "image/x-icon");

		// Joint Photographic Experts Group JFIF format
		mimeTypes.put("jpg", "image/jpeg");
		mimeTypes.put("jpeg", "image/jpeg");
		mimeTypes.put("jpe", "image/jpeg");
		mimeTypes.put("jpz", "image/jpeg");

		// Portable Network Graphics
		mimeTypes.put("png", "image/png");

		// Scalable Vector Gaphics
		mimeTypes.put("svg", "image/svg-xml");

		// Wireless Bitmap (level 0) image
		mimeTypes.put("wbmp", "image/vnd.wap.wbmp");

		// Tagged Image File Format
		mimeTypes.put("tiff", "image/tiff");
		mimeTypes.put("tif", "image/tiff");

		// Raw red, green, and blue samples
		mimeTypes.put("rgb", "image/x-rgb");

	}
	
	public static String getMimeType(String extension) {
		String mimeType = mimeTypes.get(extension);
		if(mimeType == null) {
			return OCTET_MIME_TYPE;
		} else {
			return mimeType;
		}
	}
}
